Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: use SSH connection check instead of ping for host verification #1180

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

PolynomialDivision
Copy link
Contributor

To run the mass update script, you must be connected to the internal mesh network. If you're not connected, the script will report that routers or access points cannot be found. However, many users connect via proxy jumps through our gateways to manage devices via SSH. In its current state, the script relies on ping to verify connectivity, which fails when SSH access is possible but ping is not working.

This update changes the script to check for an active SSH connection instead of relying on ping. This ensures that the SSH daemon is up and reachable, providing a more accurate verification of host availability, rather than just testing for ICMP echo requests.

mass-update.sh Outdated
@@ -60,7 +60,7 @@ fi
# Function to check reachability
check_reachability() {
local hostname="$1"
if ping -4 -c 1 "$hostname" >/dev/null 2>&1 || ping -6 -c 1 "$hostname" >/dev/null 2>&1; then
if ssh -q -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=5 "$hostname" exit >/dev/null 2>&1; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be root@$hostname otherwise it will only work if you are already root.

@Noki
Copy link
Member

Noki commented Feb 6, 2025

Thank you for this one! This is great! The only downside is that without a password prompt we can't update the old nanosations with this anymore as they don't support ed25519 and require rsa due to limitations of the tiny target. But creating an additional RSA key for that is probably the way to go and the tiny targets were always a bit problematic to flash anyway.

To run the mass update script, you must be connected to the internal mesh
network. If you're not connected, the script will report that routers or
access points cannot be found. However, many users connect via proxy jumps
through our gateways to manage devices via SSH. In its current state, the
script relies on ping to verify connectivity, which fails when SSH access is
possible but ping is not working.

This update changes the script to check for an active SSH connection instead
of relying on ping. This ensures that the SSH daemon is up and reachable,
providing a more accurate verification of host availability, rather than
just testing for ICMP echo requests.
@Noki Noki force-pushed the ssh-connec-check-massupdate branch from 374a7c5 to 4f2a98c Compare February 6, 2025 07:00
@Noki Noki merged commit 340e2f1 into main Feb 6, 2025
12 checks passed
@Noki Noki deleted the ssh-connec-check-massupdate branch February 6, 2025 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants